package com.event.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.event.pojo.User;
import com.event.mapper.UserMapper;
import com.event.service.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author 孤雏
 * @since 2021-08-09
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Autowired
    UserMapper userMapper;
    @Override
    @Cacheable("User")
    public List<User> selectUser(User user){

        return userMapper.selectUser(user);
    }

    @Override
    @Transactional
    @CacheEvict(value = "User", allEntries=true)
    public int updateUser(User user) {
        return userMapper.updateUser(user);
    }
}
